package groep3.ssc.main;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class SkateAppPagerAdapter extends FragmentStatePagerAdapter
{

    public static enum Pages {
        COACHVIEW, SKATERVIEW
    };

    public SkateAppPagerAdapter(FragmentManager fm)
    {
        super(fm);
    }

    @Override
    public Fragment getItem(int item)
    {
        Fragment fragment = null;

        Pages page = getPagesValue(item);
        switch (page)
        {
            case COACHVIEW:
                fragment = new CoachFragment();
                break;
            case SKATERVIEW:
                fragment = new SkaterFragment();
                break;
        }

        return fragment;
    }

    private Pages getPagesValue(int item)
    {
        Pages[] aPages = Pages.values();

        System.out.println(aPages.length + "///" + item);
        if (item <= aPages.length)
        {
            return aPages[item];
        }
        return Pages.COACHVIEW;//default
    }

    @Override
    public int getCount()
    {
        return 2;
    }
}
